package morenoapp.model;

import java.io.File;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import morenoapp.model.data.MorenoModelBatchJob;
import morenoapp.model.data.MorenoModelFace;
import morenoapp.model.data.MorenoQuestionFace;
import morenoapp.model.data.MorenoRespondentFace;
import morenoapp.model.enums.MorenoModelStage;
import morenoapp.model.enums.MorenoPollType;
import morenoapp.model.enums.MorenoRespondentsSortOrder;
import morenoapp.model.listeners.MorenoModelListener;
import morenoapp.model.view2.MorenoView2Face;

/**
 *
 * @author dmitry.mamonov
 */
public class MorenoModelWrapper extends MorenoModelAbstractWrapper implements MorenoModelFace {
    //generated:begin
    @Override
    public void addModelListener(MorenoModelListener _value) {
        addModelListenerImpl(_value);
    }

    @Override
    public void createModel() {
        createModelImpl();
    }

    @Override
    public MorenoView2Face getView() {
        return getViewImpl();
    }

    @Override
    public void loadModel(File _value) throws MorenoModelException {
        loadModelImpl(_value);
    }

    @Override
    public void removeModelListener(MorenoModelListener _value) {
        removeModelListenerImpl(_value);
    }

    @Override
    public void closeModel() {
        checkModelExists();
        closeModelImpl();
    }

    @Override
    public MorenoQuestionFace createQuestion() {
        checkModelExists();
        return createQuestionImpl();
    }

    @Override
    public MorenoRespondentFace createRespondent() {
        checkModelExists();
        return createRespondentImpl();
    }

    @Override
    public void deleteQuestions(Collection _value) {
        checkModelExists();
        deleteQuestionsImpl(_value);
    }

    @Override
    public void deleteRespondents(Collection _value) {
        checkModelExists();
        deleteRespondentsImpl(_value);
    }

    @Override
    public void doBatchJob(MorenoModelBatchJob _value) {
        checkModelExists();
        doBatchJobImpl(_value);
    }

    @Override
    public boolean moveQuestionDown(MorenoQuestionFace _value) {
        checkModelExists();
        return moveQuestionDownImpl(_value);
    }

    @Override
    public boolean moveQuestionUp(MorenoQuestionFace _value) {
        checkModelExists();
        return moveQuestionUpImpl(_value);
    }

    @Override
    public void sortRespondents(MorenoRespondentsSortOrder _value) {
        checkModelExists();
        sortRespondentsImpl(_value);
    }

    @Override
    public String getConclusion() {
        if (model==null) return "";
        return model.getConclusion();
    }

    @Override
    public Date getCreationDate() {
        if (model==null) return null;
        return model.getCreationDate();
    }

    @Override
    public String getDescription() {
        if (model==null) return "";
        return model.getDescription();
    }

    @Override
    public String getInquirerIntro() {
        if (model==null) return "";
        return model.getInquirerIntro();
    }

    @Override
    public long getLastId() {
        if (model==null) return 0L;
        return model.getLastId();
    }

    @Override
    public Date getLastSaveDate() {
        if (model==null) return null;
        return model.getLastSaveDate();
    }

    @Override
    public String getPollDate() {
        if (model==null) return "";
        return model.getPollDate();
    }

    @Override
    public int getPollLimit() {
        if (model==null) return 0;
        return model.getPollLimit();
    }

    @Override
    public MorenoPollType getPollType() {
        if (model==null) return MorenoPollType.NonParametricPoll;
        return model.getPollType();
    }

    @Override
    public String getResearchGroup() {
        if (model==null) return "";
        return model.getResearchGroup();
    }

    @Override
    public String getResearchName() {
        if (model==null) return "";
        return model.getResearchName();
    }

    @Override
    public String getResearchTarget() {
        if (model==null) return "";
        return model.getResearchTarget();
    }

    @Override
    public MorenoModelStage getStage() {
        if (model==null) return MorenoModelStage.NO_MODEL;
        return model.getStage();
    }

    @Override
    public URI getStoreURI() {
        if (model==null) return null;
        return model.getStoreURI();
    }

    @Override
    public String getSupervisorInfo() {
        if (model==null) return "";
        return model.getSupervisorInfo();
    }

    @Override
    public long getVersion() {
        if (model==null) return 0L;
        return model.getVersion();
    }

    @Override
    public long getVersionComaptibility() {
        if (model==null) return 0L;
        return model.getVersionComaptibility();
    }

    @Override
    public List getViewsList() {
        if (model==null) return Collections.emptyList();
        return model.getViewsList();
    }

    @Override
    public List<MorenoQuestionFace> getQuestionsList() {
        if (model==null) return java.util.Collections.emptyList();
        return model.getQuestionsList();
    }

    @Override
    public List<MorenoRespondentFace> getRespondentsList() {
        if (model==null) return java.util.Collections.emptyList();
        return model.getRespondentsList();
    }

    @Override
    public long nextId() {
        checkModelExists();
        return model.nextId();
    }

    @Override
    public void saveModel(File _value) throws MorenoModelException {
        checkModelExists();
        model.saveModel(_value);
    }

    @Override
    public void setConclusion(String _value) {
        System.out.println("model.conclusion is set to :"+_value);
        checkModelExists();
        String oldValue = model.getConclusion();
        model.setConclusion(_value);
        firePropertyChange("conclusion", oldValue, _value);
    }

    @Override
    public void setDescription(String _value) {
        System.out.println("model.description is set to :"+_value);
        checkModelExists();
        String oldValue = model.getDescription();
        model.setDescription(_value);
        firePropertyChange("description", oldValue, _value);
    }

    @Override
    public void setInquirerIntro(String _value) {
        System.out.println("model.inquirerIntro is set to :"+_value);
        checkModelExists();
        String oldValue = model.getInquirerIntro();
        model.setInquirerIntro(_value);
        firePropertyChange("inquirerIntro", oldValue, _value);
    }

    @Override
    public void setLastId(long _value) {
        System.out.println("model.lastId is set to :"+_value);
        checkModelExists();
        long oldValue = model.getLastId();
        model.setLastId(_value);
        firePropertyChange("lastId", oldValue, _value);
    }

    @Override
    public void setPollDate(String _value) {
        System.out.println("model.pollDate is set to :"+_value);
        checkModelExists();
        String oldValue = model.getPollDate();
        model.setPollDate(_value);
        firePropertyChange("pollDate", oldValue, _value);
    }

    @Override
    public void setPollLimit(int _value) {
        System.out.println("model.pollLimit is set to :"+_value);
        checkModelExists();
        int oldValue = model.getPollLimit();
        model.setPollLimit(_value);
        firePropertyChange("pollLimit", oldValue, _value);
    }

    @Override
    public void setPollType(MorenoPollType _value) {
        System.out.println("model.pollType is set to :"+_value);
        checkModelExists();
        MorenoPollType oldValue = model.getPollType();
        model.setPollType(_value);
        firePropertyChange("pollType", oldValue, _value);
    }

    @Override
    public void setResearchGroup(String _value) {
        System.out.println("model.researchGroup is set to :"+_value);
        checkModelExists();
        String oldValue = model.getResearchGroup();
        model.setResearchGroup(_value);
        firePropertyChange("researchGroup", oldValue, _value);
    }

    @Override
    public void setResearchName(String _value) {
        System.out.println("model.researchName is set to :"+_value);
        checkModelExists();
        String oldValue = model.getResearchName();
        model.setResearchName(_value);
        firePropertyChange("researchName", oldValue, _value);
    }

    @Override
    public void setResearchTarget(String _value) {
        System.out.println("model.researchTarget is set to :"+_value);
        checkModelExists();
        String oldValue = model.getResearchTarget();
        model.setResearchTarget(_value);
        firePropertyChange("researchTarget", oldValue, _value);
    }

    @Override
    public void setSupervisorInfo(String _value) {
        System.out.println("model.supervisorInfo is set to :"+_value);
        checkModelExists();
        String oldValue = model.getSupervisorInfo();
        model.setSupervisorInfo(_value);
        firePropertyChange("supervisorInfo", oldValue, _value);
    }

    protected void firePropertiesAllChanged() {
        firePropertyChange("conclusion",null, getConclusion());
        firePropertyChange("creationDate",null, getCreationDate());
        firePropertyChange("description",null, getDescription());
        firePropertyChange("inquirerIntro",null, getInquirerIntro());
        firePropertyChange("lastId",null, getLastId());
        firePropertyChange("lastSaveDate",null, getLastSaveDate());
        firePropertyChange("pollDate",null, getPollDate());
        firePropertyChange("pollLimit",null, getPollLimit());
        firePropertyChange("pollType",null, getPollType());
        firePropertyChange("researchGroup",null, getResearchGroup());
        firePropertyChange("researchName",null, getResearchName());
        firePropertyChange("researchTarget",null, getResearchTarget());
        firePropertyChange("stage",null, getStage());
        firePropertyChange("storeURI",null, getStoreURI());
        firePropertyChange("supervisorInfo",null, getSupervisorInfo());
        firePropertyChange("version",null, getVersion());
        firePropertyChange("versionComaptibility",null, getVersionComaptibility());
        firePropertyChange("viewsList",null, getViewsList());
        firePropertyChange("questionsList",null, getQuestionsList());
        firePropertyChange("respondentsList",null, getRespondentsList());
    }
    //generated:end
}
